<template>
  <div class="home card">
    <div class="home-box">
      <h3 class="title">今日个微数据</h3>
      <div class="main">
        <div class="item">
          <img src="./assets/add.png" alt="" />
          <span class="num">{{ todayData.mmAddCount }}</span>
          <span>加好友总数</span>
        </div>
        <div class="item">
          <img src="./assets/pass.png" alt="" />
          <span class="num">{{ todayData.mmPassCount }}</span>
          <span>通过好友数</span>
        </div>
        <div class="item">
          <img src="./assets/search.png" alt="" />
          <span class="num">{{ todayData.mmNoExistsCount }}</span>
          <span>搜索不存在数</span>
        </div>
        <div class="item">
          <img src="./assets/reply.png" alt="" />
          <span class="num">{{ todayData.mmResponseCount }}</span>
          <span>好友回复数</span>
        </div>
      </div>
    </div>
    <div class="home-box">
      <h3 class="title">昨日个微数据</h3>
      <div class="main">
        <div class="item">
          <img src="./assets/add.png" alt="" />
          <span class="num">{{ yesterdayData.mmAddCount }}</span>
          <span>加好友总数</span>
        </div>
        <div class="item">
          <img src="./assets/pass.png" alt="" />
          <span class="num">{{ yesterdayData.mmPassCount }}</span>
          <span>通过好友数</span>
        </div>
        <div class="item">
          <img src="./assets/search.png" alt="" />
          <span class="num">{{ yesterdayData.mmNoExistsCount }}</span>
          <span>搜索不存在数</span>
        </div>
        <div class="item">
          <img src="./assets/reply.png" alt="" />
          <span class="num">{{ yesterdayData.mmResponseCount }}</span>
          <span>好友回复数</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts" name="home">
import { ref } from "vue";
import { getTodayDataApi, getYesterdayDataApi } from "@/api/modules/business";

const todayData = ref<Record<string, any>>({
  mmAddCount: 0,
  mmPassCount: 0,
  mmNoExistsCount: 0,
  mmResponseCount: 0,
  weworkAddCount: 0,
  weworkPassCount: 0,
  weworkNoExistsCount: 0,
  weworkResponseCount: 0
});
const yesterdayData = ref<Record<string, any>>({
  mmAddCount: 0,
  mmPassCount: 0,
  mmNoExistsCount: 0,
  mmResponseCount: 0,
  weworkAddCount: 0,
  weworkPassCount: 0,
  weworkNoExistsCount: 0,
  weworkResponseCount: 0
});

async function getData() {
  const data = await getTodayDataApi();
  todayData.value = data.data;
}

async function getYesterdayData() {
  const data = await getYesterdayDataApi();
  yesterdayData.value = data.data;
}

getData();
getYesterdayData();
</script>

<style scoped lang="scss">
@import "./index";
</style>
